//
//  LoginViewController.m
//  OCDome
//
//  Created by 李含文 on 2020/10/10.
//  Copyright © 2020 李含文. All rights reserved.
//

#import "LoginViewController.h"
#import "MyNavigationController.h"
#import "UIViewController+HWBackClickIntercept.h"
#import "RegisteredViewController.h"
#import "HWAlertManager.h"
#import "HWRemindLabel.h"
#import "HWTimer.h"

@interface LoginViewController ()
@property (weak, nonatomic) IBOutlet HWRemindLabel *label;

/// <#name#>
@property (nonatomic, strong) HWTimer *timer;
@end

@implementation LoginViewController

- (HWTimer *)timer {
    if (!_timer) {
        _timer = [HWTimer new];
    }
    return _timer;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self hw_customBackButton];
    self.title = @"登录";
    self.label.text = @"12421421";
    [self addTimer];
}

- (void)addTimer {
    [self.timer startTimerWithInterval:0.1 target:self action:^{
        NSLog(@"定时器执行中");
    }];
}
- (void)dealloc {
//    [self.timer stopTimer];
}
- (IBAction)btnClick:(id)sender {
    RegisteredViewController *vc = [RegisteredViewController new];
    [self.navigationController pushViewController:vc animated:YES];
}

+ (void)show:(void(^ _Nullable)(void))action {
    [HUDManage showLoadingHUD];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [HUDManage dismiss];
    });
    LoginViewController *vc = [[LoginViewController alloc] init];
    MyNavigationController *nav = [[MyNavigationController alloc] initWithRootViewController:vc];
    nav.modalPresentationStyle = UIModalPresentationFullScreen;
    [HW_MainWindow().rootViewController presentViewController:nav animated:YES completion:^{
        if (action) {
            action();
        }
    }];
}
- (BOOL)hw_navigationShouldPopOnBackButton {
    __weak typeof(self) weakself = self;
    [HWAlertManager hw_showAlert:@"温馨提示" message:@"是否放弃注册" actionTitles:@[@"放弃"] actionBlock:^(NSInteger index) {
//        [weakself.navigationController popViewControllerAnimated:YES];
        [weakself dismissViewControllerAnimated:YES completion:nil];
    }];
    return NO;
}

@end
